package byx.container.annotation.extension.impl;

import byx.container.annotation.annotation.ConditionalOn;
import byx.container.core.Container;

public class ConditionalOnHandler extends ConditionalAnnotationHandler<ConditionalOn> {
    @Override
    public boolean needToRegister(ConditionalOn annotation, Container container) {
        Class<?>[] classes = annotation.value();
        for (Class<?> type : classes) {
            if (!container.exist(type)) {
                return false;
            }
        }
        return true;
    }
}
